using System;
using System.Collections.Generic;
using Top.Api.Util;
using Top.Api;
using Top.Api.DingTalk;

namespace DingTalk.Api.Request
{
    /// <summary>
    /// TOP API: dingtalk.oapi.finance.loan.notify.repayment.overdue
    /// </summary>
    public class OapiFinanceLoanNotifyRepaymentOverdueRequest : BaseDingTalkRequest<DingTalk.Api.Response.OapiFinanceLoanNotifyRepaymentOverdueResponse>
    {
        /// <summary>
        /// 本次通知未还利息(单位：分)
        /// </summary>
        public Nullable<long> CurrentUnpaidInterest { get; set; }

        /// <summary>
        /// 本次通知未还罚息(单位：分，精确2位小数，没有则为0)=该期次本金罚息次+该期次利息罚息
        /// </summary>
        public Nullable<long> CurrentUnpaidPenalty { get; set; }

        /// <summary>
        /// 本次通知未还本金(单位：分）
        /// </summary>
        public Nullable<long> CurrentUnpaidPrincipal { get; set; }

        /// <summary>
        /// 本次通知未还总金额(单位：分)：未还本金+未还利息+未还罚息
        /// </summary>
        public Nullable<long> CurrentUnpaidTotalAmount { get; set; }

        /// <summary>
        /// 身份证号
        /// </summary>
        public string IdCardNo { get; set; }

        /// <summary>
        /// 利息逾期天数(没有则为0)
        /// </summary>
        public Nullable<long> IntOvdDays { get; set; }

        /// <summary>
        /// 借据编号：还款对应的借据编号
        /// </summary>
        public string LoanOrderNo { get; set; }

        /// <summary>
        /// 渠道方名称
        /// </summary>
        public string OpenChannelName { get; set; }

        /// <summary>
        /// 渠道方产品名称
        /// </summary>
        public string OpenProductName { get; set; }

        /// <summary>
        /// 本次还款时逾期期数(不包括已经还逾期的，没有则为0)：如1=第1期逾期
        /// </summary>
        public string OvdTerms { get; set; }

        /// <summary>
        /// 本次还款利息(单位：分)
        /// </summary>
        public Nullable<long> PaidInterest { get; set; }

        /// <summary>
        /// 本次还款罚息(单位：分)
        /// </summary>
        public Nullable<long> PaidPenalty { get; set; }

        /// <summary>
        /// 本次还款本金(单位：分)
        /// </summary>
        public Nullable<long> PaidPrincipal { get; set; }

        /// <summary>
        /// 本次还款总金额(单位：分)：本次逾期本金+本次逾期利息+本次逾期罚息
        /// </summary>
        public Nullable<long> PaidTotalAmount { get; set; }

        /// <summary>
        /// 期次对应借据应还利息(单位：分)
        /// </summary>
        public Nullable<long> PayableInterest { get; set; }

        /// <summary>
        /// 期次对应借据应还罚息(单位：分，没有则为0)=本金罚息+利息罚息
        /// </summary>
        public Nullable<long> PayablePenalty { get; set; }

        /// <summary>
        /// 期次对应借据应还本金(单位：分)
        /// </summary>
        public Nullable<long> PayablePrincipal { get; set; }

        /// <summary>
        /// 期次对应借据应还总金额(单位：分)：应还本金+应还利息+应还罚息
        /// </summary>
        public Nullable<long> PayableTotalAmount { get; set; }

        /// <summary>
        /// 该期次已还利息(单位：分)
        /// </summary>
        public Nullable<long> PeriodPaidInterest { get; set; }

        /// <summary>
        /// 该期次已还罚息(单位：分，精确2位小数，没有则为0)=该期次本金罚息+该期次利息罚息
        /// </summary>
        public Nullable<long> PeriodPaidPenalty { get; set; }

        /// <summary>
        /// 该期次已还本金(单位：分)
        /// </summary>
        public Nullable<long> PeriodPaidPrincipal { get; set; }

        /// <summary>
        /// 该期次已还总金额(单位：分)
        /// </summary>
        public Nullable<long> PeriodPaidTotalAmount { get; set; }

        /// <summary>
        /// 该期次应还利息(单位：分)
        /// </summary>
        public Nullable<long> PeriodPayableInterest { get; set; }

        /// <summary>
        /// 该期次应还罚息(单位：分，没有则为0)
        /// </summary>
        public Nullable<long> PeriodPayablePenalty { get; set; }

        /// <summary>
        /// 该期次应还本金(单位：分)
        /// </summary>
        public Nullable<long> PeriodPayablePrincipal { get; set; }

        /// <summary>
        /// 该期次应还总金额(单位：分)：应还本金+应还利息+应还罚息
        /// </summary>
        public Nullable<long> PeriodPayableTotalAmount { get; set; }

        /// <summary>
        /// 本金逾期天数(没有则为0)
        /// </summary>
        public Nullable<long> PrinOvdDays { get; set; }

        /// <summary>
        /// 本次还款日期
        /// </summary>
        public string RepayRealDate { get; set; }

        /// <summary>
        /// 还款期数：如1=第1期
        /// </summary>
        public string RepaymentTerms { get; set; }

        /// <summary>
        /// 发送钉钉卡片消息：0 不发送，1 发送
        /// </summary>
        public Nullable<long> SendDingDingMsg { get; set; }

        /// <summary>
        /// 手机号
        /// </summary>
        public string UserMobile { get; set; }

        #region IDingTalkRequest Members

        public override string GetApiName()
        {
            return "dingtalk.oapi.finance.loan.notify.repayment.overdue";
        }

        public override string GetApiCallType()
        {
            return DingTalkConstants.CALL_TYPE_OAPI;
        }

        public override IDictionary<string, string> GetParameters()
        {
            TopDictionary parameters = new TopDictionary();
            parameters.Add("current_unpaid_interest", this.CurrentUnpaidInterest);
            parameters.Add("current_unpaid_penalty", this.CurrentUnpaidPenalty);
            parameters.Add("current_unpaid_principal", this.CurrentUnpaidPrincipal);
            parameters.Add("current_unpaid_total_amount", this.CurrentUnpaidTotalAmount);
            parameters.Add("id_card_no", this.IdCardNo);
            parameters.Add("int_ovd_days", this.IntOvdDays);
            parameters.Add("loan_order_no", this.LoanOrderNo);
            parameters.Add("open_channel_name", this.OpenChannelName);
            parameters.Add("open_product_name", this.OpenProductName);
            parameters.Add("ovd_terms", this.OvdTerms);
            parameters.Add("paid_interest", this.PaidInterest);
            parameters.Add("paid_penalty", this.PaidPenalty);
            parameters.Add("paid_principal", this.PaidPrincipal);
            parameters.Add("paid_total_amount", this.PaidTotalAmount);
            parameters.Add("payable_interest", this.PayableInterest);
            parameters.Add("payable_penalty", this.PayablePenalty);
            parameters.Add("payable_principal", this.PayablePrincipal);
            parameters.Add("payable_total_amount", this.PayableTotalAmount);
            parameters.Add("period_paid_interest", this.PeriodPaidInterest);
            parameters.Add("period_paid_penalty", this.PeriodPaidPenalty);
            parameters.Add("period_paid_principal", this.PeriodPaidPrincipal);
            parameters.Add("period_paid_total_amount", this.PeriodPaidTotalAmount);
            parameters.Add("period_payable_interest", this.PeriodPayableInterest);
            parameters.Add("period_payable_penalty", this.PeriodPayablePenalty);
            parameters.Add("period_payable_principal", this.PeriodPayablePrincipal);
            parameters.Add("period_payable_total_amount", this.PeriodPayableTotalAmount);
            parameters.Add("prin_ovd_days", this.PrinOvdDays);
            parameters.Add("repay_real_date", this.RepayRealDate);
            parameters.Add("repayment_terms", this.RepaymentTerms);
            parameters.Add("send_ding_ding_msg", this.SendDingDingMsg);
            parameters.Add("user_mobile", this.UserMobile);
            if (this.otherParams != null)
            {
                parameters.AddAll(this.otherParams);
            }
            return parameters;
        }

        public override void Validate()
        {
            RequestValidator.ValidateRequired("current_unpaid_interest", this.CurrentUnpaidInterest);
            RequestValidator.ValidateRequired("current_unpaid_penalty", this.CurrentUnpaidPenalty);
            RequestValidator.ValidateRequired("current_unpaid_principal", this.CurrentUnpaidPrincipal);
            RequestValidator.ValidateRequired("current_unpaid_total_amount", this.CurrentUnpaidTotalAmount);
            RequestValidator.ValidateRequired("id_card_no", this.IdCardNo);
            RequestValidator.ValidateRequired("int_ovd_days", this.IntOvdDays);
            RequestValidator.ValidateRequired("loan_order_no", this.LoanOrderNo);
            RequestValidator.ValidateRequired("open_channel_name", this.OpenChannelName);
            RequestValidator.ValidateRequired("open_product_name", this.OpenProductName);
            RequestValidator.ValidateRequired("ovd_terms", this.OvdTerms);
            RequestValidator.ValidateRequired("paid_interest", this.PaidInterest);
            RequestValidator.ValidateRequired("paid_penalty", this.PaidPenalty);
            RequestValidator.ValidateRequired("paid_principal", this.PaidPrincipal);
            RequestValidator.ValidateRequired("paid_total_amount", this.PaidTotalAmount);
            RequestValidator.ValidateRequired("payable_interest", this.PayableInterest);
            RequestValidator.ValidateRequired("payable_penalty", this.PayablePenalty);
            RequestValidator.ValidateRequired("payable_principal", this.PayablePrincipal);
            RequestValidator.ValidateRequired("payable_total_amount", this.PayableTotalAmount);
            RequestValidator.ValidateRequired("period_paid_interest", this.PeriodPaidInterest);
            RequestValidator.ValidateRequired("period_paid_penalty", this.PeriodPaidPenalty);
            RequestValidator.ValidateRequired("period_paid_principal", this.PeriodPaidPrincipal);
            RequestValidator.ValidateRequired("period_paid_total_amount", this.PeriodPaidTotalAmount);
            RequestValidator.ValidateRequired("period_payable_interest", this.PeriodPayableInterest);
            RequestValidator.ValidateRequired("period_payable_penalty", this.PeriodPayablePenalty);
            RequestValidator.ValidateRequired("period_payable_principal", this.PeriodPayablePrincipal);
            RequestValidator.ValidateRequired("period_payable_total_amount", this.PeriodPayableTotalAmount);
            RequestValidator.ValidateRequired("prin_ovd_days", this.PrinOvdDays);
            RequestValidator.ValidateRequired("repay_real_date", this.RepayRealDate);
            RequestValidator.ValidateRequired("repayment_terms", this.RepaymentTerms);
            RequestValidator.ValidateRequired("send_ding_ding_msg", this.SendDingDingMsg);
            RequestValidator.ValidateRequired("user_mobile", this.UserMobile);
        }

        #endregion
    }
}
